<h1>FIFA 18 - Tous les clubs</h1>

<div class="title_w_bg">Liste des clubs référencés</div>


<table class="scoreboard">
  <tr>
    <th>ID du club</th>
    <th>Det.</th>
    <th>Nom</th>
    <th>Niveau</th>
    <th>Couleur</th>
    <th>Url image</th>
  </tr>
  <br>
  <% if @clubs.count == 0 %>
    <tr> <td> Pas de club enregistré </td> </tr>
  <% else %>
    <% @clubs.order('name ASC').each do |club| %>
    <tr>
        <td><%= link_to club.id, club_path(club) %></td>
        <td><%= club.denominateur %> </td>
        <td><%= club.name %> </td>
        <td><%= club.level %> </td>
        <td style="background-color:<%= club.color%>"></td>
        <td><%= club.image_url %> </td>
        <td><%= link_to "Modifier", edit_club_path(club)%></td>
        <td><% if Team.includes(:clubs).where("club_id = ?", club.id).empty? %>
                <%= link_to 'Supprimer', club_path(club), method: :delete, data: { confirm: 'Etes vous sur ?' }%>
            <% end%>
        </td>

    </tr>
    <% end %>
  <% end %>
</table>
